package cn.retalsystem.controller;

import cn.retalsystem.bean.Admin;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.bind.annotation.SessionAttributes;

import javax.servlet.http.HttpSession;

/**
 * @Author: 官宝星
 * @Date: 2019/10/29 22:46
 * @Version 1.0
 * @描述：
 */
@Controller
public class HelloContoller {

    @RequestMapping("/getSession")
    @ResponseBody
    public Admin getAdmin(HttpSession session){
        return (Admin) session.getAttribute("admin");
    }

    @RequestMapping("/hello")
    public  String test(){
        return "dd";
    }

    @RequestMapping("/setUsername")
    public String setUsername(Model model){
        model.addAttribute("username","李二蛋");
        System.out.println("存入name");
        return "dd";
    }
    @RequestMapping("/getName")
    public String getName(HttpSession session){
        return "dd";
    }

    @RequestMapping("/getText")
    @ResponseBody
    public String getText(){
        return "hello";
    }




}
